
<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>表增加</title>
    <link href="/static/devtools30/layui/css/layui.css" rel="stylesheet" />
    <link href="/static/devtools30/css/devindexbase.css" rel="stylesheet" />
    <script src="/static/devtools30/js/jquery-1.11.2.min.js" type="text/javascript"></script>
    <script src="/static/devtools30/layui/layui.all.js" type="text/javascript"></script>
    <script src="/static/devtools30/js/devtoolCommon.js" type="text/javascript"></script>
<style>
    /*页面内边距*/

    .addwrap {
        padding: 30px;
    }


    /*按钮组边框*/

    .layui-btn-primary {
        border: 1px solid #C9C9C9!important;
    }


    /*输入框，下拉框子项高度*/

    .addwrap .layui-input,
    .layui-select {
        height: 25px;
    }


    /*下拉框子项高度*/

    .addwrap .layui-form-select dl {
        top: 26px;
        padding: 0;
    }


    /*下拉框子项内容高度*/

    .addwrap .layui-form-select dl dd,
    .layui-form-select dl dt {
        line-height: 24px;
    }

    .addwrap .layui-input-block {
        min-height: 26px;
        margin-left: 30px;
    }

    .addwrap .layui-form-label {
        padding: 0;
        text-align: left;
        height: 26px;
        line-height: 26px;
        width: auto;
    }
</style>
</head>
<body>
<div class="backgroundf addwrap">
    <div class="layui-form" lay-filter="form">
        <input type="hidden" name="id" id ="id" th:value="${data.id}"/>
        <div class="flex flex-jusity-betreen">
            <div class="layui-form-item">
                <label class="layui-form-label">序号</label>
                <div class="layui-input-block">
                    <input id="xh" name="xh" th:value="${data.xh}" type="number" onkeydown="DigitInput(this)"   required  lay-verify="required" autocomplete="off" class="layui-input">
                </div>

            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">分类</label>
                <div class="layui-input-block">
                    <select id="flid" name="flid" lay-filter="flid">
                        <option th:each="c : ${TypeList}"  th:value="${c.id}" th:utext="${c.mc}">
                        </option>
                    </select>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">名称</label>
            <div class="layui-input-block">
                <input type="text"  name="mc" id="mc" th:value="${data.mc}" lay-verify="required" lay-reqtext="名称不能为空" placeholder="请输入名称" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="flex flex-align-center height26">
            <div class="layui-form-item flex flex-align-center">
                <label class="layui-form-label">代码</label>
                <div class="layui-input-block" style="margin-left: 6px">
                    <input type="text" name="dm" id="dm" th:value="${data.dm}" lay-verify="required" lay-reqtext="代码不能为空" placeholder="请输入代码" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-input-block">
                <input  type="checkbox" value="true"  th:checked="${data.cancel eq true} ? 'checked' :'false'" name="cancel" id="cancel" title="作废" lay-skin="primary">
                </div>
            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <input type="text" name="bz" id="bz" th:value="${data.bz}" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="flex flex-jusity-around tjbtn">
                <button class="layui-btn layui-btn-radius layui-btn-sm layui-btn-primary qx" onclick="closeWin()">取消</button>
                <button class="layui-btn layui-btn-radius layui-btn-sm " lay-submit lay-filter="save">保存</button>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    $(function(){
        initEvent();
    });
    function closeWin(){
        dlCommon.closeParentLayer();
    }
    function initEvent(){
        layui.form.on('submit(save)', function(data){
            saveData();
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
        $("#flid option[value='[(${data.flid})]']").attr("selected", "selected");
        layui.form.render();
    }
    function saveData(){
        var data = layui.form.val('form');
        if(data.cancel==undefined){
            data.cancel=false;
        }
        dlCommon.post("/DevtApiMainEntityController/save",data,function(res){
            if(!res.success){
                dlCommon.layerError(res.msg);
                return;
            }
            dlCommon.layerSuccess("保存成功",function(){
                parent.loadData();
                closeWin();
            })
        },true)
    }
</script>
</html>
